import { getUserDepID, getCompanyID, getUserID } from '@/utils';

/**  领用 Manage数据范围权限判断 */
export const ApplyManageTab = (curRes: Record<string, any>) => {
  if (curRes?.['/assetApplyAllot/createCompanyID']) {
    return {
      createCompanyID: getCompanyID(),
      params: 'createCompanyID',
    };
  } else if (curRes?.['/assetApplyAllot/createDepartmentID']) {
    return {
      createDepartmentID: getUserDepID(),
      params: 'createDepartmentID',
    };
  } else if (curRes?.['/assetApplyAllot/createrID']) {
    return {
      createrID: getUserID(),
      params: 'createrID',
    };
  } else {
    return {};
  }
};

export const AssetMaterialManage = (curRes: Record<string, any>) => {
  if (curRes?.['/assetController/allot/useCompanyID']) {
    return {
      useCompanyID: getCompanyID(),
      params: 'useCompanyID',
    };
  } else if (curRes?.['/assetController/allot/useDepartmentID']) {
    return {
      useDepartmentID: getUserDepID(),
      params: 'useDepartmentID',
    };
  } else {
    return {
      userID: getUserID(),
      params: 'userID',
    };
  }
};

/**
 * 仓库权限管理
 * @param curRes
 * @returns
 */
export const getManageTabSwitch = (curRes: Record<string, any>) => {
  if (curRes?.['/assetStore/createCompanyID']) {
    return {
      createCompanyID: getCompanyID(),
      params: 'createCompanyID',
    };
  } else {
    return {
      storeCompanyID: getCompanyID(),
      params: 'storeCompanyID',
    };
  }
};
